package club.twelveblog.tblog.dao;

import club.twelveblog.tblog.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;


@Repository
public interface UserDao extends JpaRepository<User, Long>, PagingAndSortingRepository<User, Long> {
    //    @Query(nativeQuery = true,value = "SELECT * FROM tb_user WHERE user_name=?1 AND password=?1")
//    User findUserByUser_nameAndPassword(String user_name, String password);
//    User findByUsernameAndPassword(String user_name, String password);
//    User findByUser_name(String username);
    //@Query(nativeQuery = true,value = "SELECT * FROM tb_user WHERE user_id=?1")
    //User findById(int user_id);

    //
    @Query(nativeQuery = true,value = "SELECT user_locked FROM tb_user WHERE username=?1")
    Integer isLock(String username);

    User findByUsername(String username);

}
